function [idx,A] = fullcolrank(A)

nx = size(A,2);
K = rank(A'*A);

if (K==nx)
    idx = true([1 nx]);
else
    [~,~,v] = qr(A,'econ','vector');
    idx = ismember(1:nx,v(1:K));
end

if (nargout==2) && ~(K==nx)
    A = A(:,idx);
end
